{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# MTH 9879 Market Microstructure Models,    Spring 2015 \n",
    "\n",
    "## Lecture 1: Market mechanisms and zero intelligence models of the order book\n",
    "\n",
    "Tai-Ho Wang    \n",
    "Department of Mathematics   \n",
    "  \n",
    "  \n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2014/09/BCCUNYstacked_BLK.jpg\" align = \"center\" width=160></h2>  \n",
    "\n",
    "$$\n",
    "\\newcommand{\\bea}{\\begin{eqnarray}}\n",
    "\\newcommand{\\eea}{\\end{eqnarray}}\n",
    "\\newcommand{\\supp}{\\mathrm{supp}}\n",
    "\\newcommand{\\F}{\\mathcal{F} }\n",
    "\\newcommand{\\cF}{\\mathcal{F} }\n",
    "\\newcommand{\\E}{\\mathbb{E} }\n",
    "\\newcommand{\\Eof}[1]{\\mathbb{E}\\left[ #1 \\right]}\n",
    "\\def\\Cov{{ \\mbox{Cov} }}\n",
    "\\def\\Var{{ \\mbox{Var} }}\n",
    "\\newcommand{\\1}{\\mathbf{1} }\n",
    "\\newcommand{\\p}{\\partial}\n",
    "\\newcommand{\\PP}{\\mathbb{P} }\n",
    "\\newcommand{\\Pof}[1]{\\mathbb{P}\\left[ #1 \\right]}\n",
    "\\newcommand{\\QQ}{\\mathbb{Q} }\n",
    "\\newcommand{\\R}{\\mathbb{R} }\n",
    "\\newcommand{\\DD}{\\mathbb{D} }\n",
    "\\newcommand{\\HH}{\\mathbb{H} }\n",
    "\\newcommand{\\spn}{\\mathrm{span} }\n",
    "\\newcommand{\\cov}{\\mathrm{cov} }\n",
    "\\newcommand{\\HS}{\\mathcal{L}_{\\mathrm{HS}} }\n",
    "\\newcommand{\\Hess}{\\mathrm{Hess} }\n",
    "\\newcommand{\\trace}{\\mathrm{trace} }\n",
    "\\newcommand{\\LL}{\\mathcal{L} }\n",
    "\\newcommand{\\s}{\\mathcal{S} }\n",
    "\\newcommand{\\ee}{\\mathcal{E} }\n",
    "\\newcommand{\\ff}{\\mathcal{F} }\n",
    "\\newcommand{\\hh}{\\mathcal{H} }\n",
    "\\newcommand{\\bb}{\\mathcal{B} }\n",
    "\\newcommand{\\dd}{\\mathcal{D} }\n",
    "\\newcommand{\\g}{\\mathcal{G} }\n",
    "\\newcommand{\\half}{\\frac{1}{2} }\n",
    "\\newcommand{\\T}{\\mathcal{T} }\n",
    "\\newcommand{\\bit}{\\begin{itemize}}\n",
    "\\newcommand{\\eit}{\\end{itemize}}\n",
    "\\newcommand{\\beq}{\\begin{equation}}\n",
    "\\newcommand{\\eeq}{\\end{equation}}\n",
    "\\newcommand{\\tr}{\\mbox{tr}}\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Outline of Lecture 1\n",
    "\n",
    "* Overview of the course\n",
    "\n",
    "* Market structure\n",
    "\n",
    "    * Order types\n",
    "    \n",
    "    * Market types\n",
    "    \n",
    "    * Trading venues\n",
    "\n",
    "* A brief introduction to R\n",
    "\n",
    "* Zero intelligence models\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Why study market microstructure?\n",
    "\n",
    "* To understand better how to trade: Specifically, how to design algorithms.\n",
    "\n",
    "    * Market microstructure theory could be viewed as the theory underlying algorithmic trading.\n",
    "\n",
    "* To be able to talk to informed clients.\n",
    "\n",
    "* To understand the process of price formation.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Aims of this course\n",
    "\n",
    "* To be able to read and understand market microstructure literature.\n",
    "\n",
    "    * In particular, to be familiar with well-known microstructure models.\n",
    "\n",
    "* To be familiar with empirical characteristics of order books and time series, understanding their implications for modeling and trading."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Philosophical overview\n",
    "\n",
    "* Two extreme views of the market:\n",
    "    \n",
    "    * Completely random\n",
    "        \n",
    "        * The zero intelligence model associated with econophysics.\n",
    "        * Use of statistical physics techniques.\n",
    "\n",
    "    * Completely rational\n",
    "        * Strategic trader models associated with efficient markets theory.\n",
    "        * Game theoretic solutions.\n",
    "\n",
    "* Reality is somewhere in-between."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Order types\n",
    "\n",
    "Two basic order types:\n",
    "\n",
    "* Market orders\n",
    "    * Always executed if there is sufficient quantity available.\n",
    "\n",
    "* Limit orders\n",
    "    * May be executed only if limit price reached (note \"may\" not \"will\"!).\n",
    "    * Typically priorities are price first, then time.\n",
    "\n",
    "\n",
    "There are many variations such as:\n",
    "\n",
    "* Fill or kill: Must be entirely filled immediately or not at all\n",
    "\n",
    "* Immediate or cancel: Fill immediately; remaining quantity is canceled\n",
    "\n",
    "* All or nothing: Must be entirely filled or not at all when the price is reached\n",
    "\n",
    "* Marketable limit buy order: Buy at limit price but no higher.  Remaining quantity becomes best bid.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Hidden orders\n",
    "\n",
    "* Users may post hidden limit orders\n",
    "\n",
    "* Hidden orders have lower priority than visible orders at the same price level.\n",
    "\n",
    "* Hidden orders are often placed between the visible bid and ask prices so market order submitters may sometimes get a price that is better than the visible best quote."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Market types\n",
    "\n",
    "* *Quote-driven* markets\n",
    "\n",
    "    * have market makers  responsible for continuously quoting two-way prices\n",
    "    * For example ISE.\n",
    "\n",
    "* Liquidity in order-driven markets is generated by customer order flow.\n",
    "\n",
    "    * Limit orders in the book replace market-maker quotes.\n",
    "\n",
    "* Hybrid markets such as the NYSE are mixtures of both.\n",
    "\n",
    "    * For example, specialists are still responsible for ensuring two-way quotes in times of stress."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Auction types\n",
    "\n",
    "Two basic types:\n",
    "\n",
    "* Batch auctions or *call markets*\n",
    "\n",
    "    * For example, opening and closing auctions on NYSE.\n",
    "    \n",
    "    * Trading takes place only when the market is called.\n",
    "        * Prices are \"called out\" until a price is found that maximizes the quantity traded.\n",
    "\n",
    "\n",
    "* Continuous auction or *continuous markets*\n",
    "\n",
    "    * For example trading during the day on NYSE.\n",
    "    * Trades can take place whenever the market is open.\n",
    "    * In a continuous market, the limit order book effectively defines supply and demand curves for the asset being traded.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## NYSE opening auction example\n",
    "\n",
    "Table 1: Example:  9:30am ET: Previous closing price of \\$17.00\n",
    "\n",
    "| Entry Time | Buy Limit Orders | Sell Limit Orders | Order Price | Matchable | Imbalance | Indicative Price |\n",
    "|:----------:|:----------------:|:-----------------:|:-----------:|:---------:|:---------:|:----------------:|\n",
    "|    8:30    |       1,000      |                   |    \\$19.00   |     0     |     0     |         -        |\n",
    "|    9:00    |                  |       1,000       |    Market   |   1,000   |     0     |      \\$19.00      |\n",
    "|    9:05    |       1,000      |                   |    \\$20.00   |   1,000   |     0     |      \\$20.00      |\n",
    "|    9:25    |                  |       1,000       |    \\$18.00   |   2,000   |     0     |      \\$18.00      |\n",
    "\n",
    "* The match price is the price that maximizes the volume that can be executed.\n",
    "\n",
    "* There are complicated rules for tie-breaking that vary between exchanges."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Continuous trading\n",
    "\n",
    "* In the continuous trading session, orders are submitted and canceled. \n",
    "\n",
    "* The set of orders with signs, sizes and prices is known as the *limit order book*.\n",
    "\n",
    "* We proceed to give a few snapshots of the BATS order book.\n",
    "\n",
    "    * BATS is the third largest US exchange after NYSE and Nasdaq.  It has the reputation of being the fastest exchange."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Trading venues\n",
    "\n",
    "In the US, trading takes place on\n",
    "\n",
    "* Organized exchanges such as NYSE and Nasdaq.\n",
    "    * Trading can be electronic via an ECN.\n",
    "    * Prices are formed through an auction process.\n",
    "\n",
    "* Crossing networks such as POSIT\n",
    "    * Crosses occur eight times daily on POSIT with a *derivative* pricing rule\n",
    "\n",
    "* Dark pools with derivative pricing rules\n",
    "    * Banks' internal crossing networks such as SIGMA X, Crossfinder, MLXN\n",
    "    * Other dark pools such as GETMatched (Getco), BIDS, Level etc.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This excerpt taken from the ITG 10-K filed Mar 1, 2007.\n",
    "\n",
    "---\n",
    "\n",
    "**POSIT**\n",
    "\n",
    "ITG POSIT crossing destinations, including POSIT Match, POSIT Now, and BLOCKalert, give buyers and sellers opportunities to match equity orders with complete confidentiality, no market impact, and the cost savings of midpoint pricing. POSIT offers unique value for traders with active, quantitative, and passive trading styles. POSIT provides access to rich, diverse liquidity, is useful for all trading styles and is especially valuable for trading small, illiquid names. All POSIT products cross at the midpoint of the National Best Bid or Offer (“NBBO”)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BZX) order book for MSFT\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BZX_MSFT.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BYX) order book for MSFT\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BYX_MSFT.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BZX) order book for BAC\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BZX_BAC.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BYX) order book for BAC\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BYX_BAC.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BZX) order book for GOOG\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BZX_GOOG.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BATS (BYX) order book for GOOG\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/BYX_GOOG.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BZX and BYX\n",
    "\n",
    "* BZX gives a rebate to limit order submitters\n",
    "    * There is an incentive to place limit orders so the size at best quote is large.\n",
    "    * Market orders are small.\n",
    "\n",
    "* BYX gives a rebate to market order submitters.\n",
    "    * Queue sizes are smaller.\n",
    "    * Market orders are bigger.\n",
    "\n",
    "* Because of different fee structures on different exchanges, the displayed spread is not the true spread."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BZX fee schedule\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/bzx.png\" align = \"center\" width=750></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## BYX fee schedule\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/byx.png\" align = \"center\" width=650></h2>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Large and small tick stocks\n",
    "\n",
    "* Stocks where the tick size is large relative to the price movement per trade are *large tick* stocks. Stocks where the tick size is small relative to the price movement per trade are *small tick* stocks.\n",
    "    * BAC is a large tick stock.\n",
    "    * GOOG is a small tick stock.\n",
    "    * MSFT is a large tick stock.\n",
    "\n",
    "* A large tick stock has a spread of one tick nearly all of the time.\n",
    "\n",
    "* Conversely, the spread of a small tick stock is typically greater than one tick (one cent in the US).\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## The SFGK zero-intelligence model\n",
    "\n",
    "In this model due to Smith, Farmer, Gillemot and Krishnamurthy:\n",
    "\n",
    "* Limit orders can be placed at any integer price level $p$ where $-\\infty < p < \\infty$.\n",
    "    * If worried about negative prices, think of these as being logarithms of the actual price.\n",
    "\n",
    "* Limit sell orders may be placed at any level greater than the best bid $B(t)$ at time $t$ and limit buy orders at any level less than the best offer $A(t)$.\n",
    "\n",
    "* In particular, just as in real markets, limit orders may be placed inside the spread (if the current spread is greater than one tick).\n",
    "\n",
    "* Market orders arrive randomly at rate $\\mu$.\n",
    "\n",
    "* Limit orders (per price level) arrive at rate $\\alpha$.\n",
    "\n",
    "* A proportion $\\delta$ of existing limit orders is canceled.\n",
    "\n",
    "* All market orders and limit orders are for one share.\n",
    "\n",
    "*  All the order flows are modeled as Poisson processes. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Analysis of the SFGK order book model\n",
    "\n",
    "* The SFGK model depends on so few parameters that, even though it is capable of generating complex behavior, it remains amenable to analytical investigation.\n",
    "\n",
    "* For example, it is easy to see that the asymptotic book depth far away from the best quote must be given by $\\alpha/\\delta$.\n",
    "\n",
    "The argument goes as follows:\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Asymptotic book depth\n",
    "\n",
    "* In the steady-state, orders arriving into the book must balance orders leaving the book.\n",
    "\n",
    "* Far away from the best quote, the probability of a limit order leaving the book as the result of an execution against a market order is very small.\n",
    "\n",
    "* Thus we need only consider new orders arriving balancing existing orders leaving due to cancelation. \n",
    "    * At a given price, for a fixed time interval $\\Delta$, the expected number of orders arriving is $\\alpha \\Delta$ and the expected number of orders canceled is $\\delta d\\Delta $ where $d$ is the number of shares at the book at that price level.    \n",
    "    * For these to balance, we must have $\\alpha \\Delta= \\delta d\\Delta$, or equivalently,\n",
    "     $$\n",
    "     d=\\frac{\\alpha}{\\delta}.\n",
    "     $$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Complex interactions\n",
    "\n",
    "* Although the model is simple to describe, its behavior can be rather complex.\n",
    "\n",
    "* For example, suppose there is one share at the best bid when the spread is two ticks.\n",
    "    * If a new buy order is placed inside the spread one tick below the best offer $A(t)$, the best bid $B(t)$ increases and the spread $s(t)$ decreases to one tick. \n",
    "    \n",
    "    * If a market sell order arrives, the book will revert to its initial state.\n",
    "\n",
    "* Now suppose that the same events occur but in the reverse order.\n",
    "    * The market sell order increases the spread to three ticks and a new limit buy order is placed one tick below the best offer.\n",
    "    \n",
    "    * The spread decreases to one tick.\n",
    "\n",
    "* The resulting book shape and even the mid-quote are quite different."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Distribution of order depth\n",
    "\n",
    "* In the SFGK model, the distribution of order depth is a function of distance to the best quote.\n",
    "    * Conditional on no change in the best quotes, order depth would be i.i.d at any given level of the book deeper\n",
    "    than the best quote.\n",
    "    \n",
    "    * In fact, as shown by SFGK, this distribution is Poisson with mean $\\alpha/\\delta$. \n",
    "    \n",
    "    * However, as the order book evolves, the best quote prices do move, and each level in the book retains some memory of having been \"visited\" by the market price at some prior time.\n",
    "\n",
    "* Strictly speaking, order depth distributions are therefore conditional on the entire history of the order book and in particular on the distance to the best quote.\n",
    "\n",
    "* The further away a given level is from the best quote, the closer the order depth distribution will be to Poisson."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Dimensional analysis\n",
    "\n",
    "* Dimensional analysis is a favorite tool of physicists used to guess the relationships between model outputs and parameters.\n",
    "    * Effectively using information about scaling relationships.\n",
    "\n",
    "* The dimensions of the parameters of the SFGK model are as follows:\n",
    "\n",
    "| Parameter | Dimensions       |\n",
    "|:-----------:|:------------------:|\n",
    "|    $\\mu$       | shares/T        |\n",
    "|    $\\alpha$       | shares/(ticks T) |\n",
    "|    $\\delta$       | 1/T              |\n",
    "\n",
    "* In the following we use these parameter dimensions to guess the functional form of relationships between measurable quantities of interest and the input parameters."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Inverse table\n",
    "\n",
    "* For convenience, we provide (unique) expressions for dimensions in terms of input parameters.\n",
    "\n",
    "* Inverting the previous table gives\n",
    "\n",
    "| Dimensions | Parameter combinations |\n",
    "|:----------:|:----------------------:|\n",
    "|   shares   |        $\\mu$ / $\\delta$       |\n",
    "|      T     |    1 / $\\delta$    |\n",
    "|    ticks   |           $\\mu$ / $\\alpha$          |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Asymptotic book depth\n",
    "\n",
    "* The asymptotic depth $d$ of the book far away from mid-market has the dimensions of $shares$ per $tick$.  The only combination of parameters with these dimensions is $\\alpha/\\delta$.\n",
    "\n",
    "* As we saw earlier, the exact result is in fact just $\\alpha/\\delta$ so the guess in this case is exactly correct.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## The spread\n",
    "\n",
    "* The spread has dimensions of $ticks$ and the only combination of parameters with these dimensions is $\\mu/\\alpha$.\n",
    "\n",
    "* Arguing more directly, inside the spread, limit orders are mostly removed by market orders.\n",
    "    \n",
    "    * The total rate of arrival of limit orders is $2\\,\\alpha\\,s$ where $s$ is the steady-state spread because as explained earlier, buy and sell orders may be placed at all levels at the spread or better.\n",
    "    \n",
    "    * The rate of removal of limit orders is just the rate of market orders $\\mu$.\n",
    "\n",
    "* We deduce that (roughly at least)\n",
    "    $$\n",
    "    s \\sim \\frac{\\mu}{2\\,\\alpha}\n",
    "    $$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## The slope of the order book\n",
    "\n",
    "* This quantity has dimensions of $shares$ per $tick$ per $tick$ (the derivative with respect to ticks of the limit order density).\n",
    "\n",
    "* The only combination of parameters that has these dimensions is\n",
    "    \n",
    "    $$\n",
    "    \\frac{\\alpha^2}{\\mu\\,\\delta}.\n",
    "    $$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Volatility\n",
    "\n",
    "* The variance of the times series of trade prices generated in this model must have dimensions $ticks^2/T$.\n",
    "\n",
    "\n",
    "* Dimensional arguments imply that variance per unit time must therefore be proportional to\n",
    "\n",
    "    $$\n",
    "    \\frac{\\mu^2\\,\\delta}{\\alpha^2}\n",
    "    $$\n",
    "\n",
    "\n",
    "* Thus volatility must scale as\n",
    "    \n",
    "    $$\n",
    "    \\frac{\\mu\\,\\sqrt{\\delta}}{\\alpha}\n",
    "    $$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Average quote size\n",
    "\n",
    "* The average quote size $Q$ should be given roughly by the cumulative steady-state inventory $s/2$ ticks away from mid-market where $s$ is the average spread.\n",
    "\n",
    "* Thus\n",
    "    \n",
    "    $$\n",
    "    Q \\sim s^2\\,\\frac{\\alpha^2}{\\mu\\,\\delta} \\sim\n",
    "    \\frac{\\mu^2}{\\alpha^2}\\,\\frac{\\alpha^2}{\\mu\\,\\delta}=\\frac{\\mu}{\\delta}\n",
    "    $$\n",
    "    \n",
    "    as we would expect because once again, ${\\mu}/{\\delta}$ is the only combination of parameters with dimensions of $shares$.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Characteristic share quantity\n",
    "\n",
    "The only quantity that can be formed from the model parameters with\n",
    "the dimensions of $shares$ is the characteristic share quantity\n",
    "\n",
    "$$\n",
    "N_c=\\frac{\\mu}{2\\,\\delta}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Market impact\n",
    "\n",
    "The most familiar market impact model is $\\sigma\\,\\sqrt{L}$ where $\\sigma$ is volatility the liquidity $L$ is fraction of average daily volume.  In this model, for a given number of shares $n$,\n",
    "\n",
    "$$\n",
    "L=\\frac{n}{\\mu}\n",
    "$$\n",
    "\n",
    "and as shown above\n",
    "\n",
    "$$\n",
    "\\sigma \\sim \\frac{\\mu\\,\\sqrt{\\delta}}{\\alpha}\n",
    "$$\n",
    "\n",
    "Re-expressing that model of market impact in terms of the parameters\n",
    "of the SFGK model gives\n",
    "\n",
    "$$\n",
    "I(n) \\sim\n",
    "\\frac{\\mu\\,\\sqrt{\\delta}}{\\alpha}\\,\\sqrt{\\frac{n}{\\mu}}=\\frac{1}{\\alpha}\\,\\sqrt{{\\mu\\,\\delta\\,n}}\n",
    "$$\n",
    "\n",
    "which has the correct dimensions of $ticks$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Market impact\n",
    "\n",
    "* In general, no matter what the form of market impact, for a given number of shares $n$ the impact must have dimensions of $ticks$.\n",
    "\n",
    "\n",
    "* The only combination of parameters with dimensions of $ticks$ is ${\\mu}/{\\alpha}$.\n",
    "\n",
    "\n",
    "* We deduce that the general form of market impact must be\n",
    "\n",
    "    $$\n",
    "    I(n)\\sim\\frac{\\mu}{\\alpha}\\,f\\left(\\frac{n}{N_c}\\right)=\\frac{\\mu}{\\alpha}\\,f\\left(\\frac{2\\,\\delta\\,n}{\\mu}\\right)\n",
    "    $$\n",
    "    \n",
    "    for some function $f(.)$.\n",
    "\n",
    "\n",
    "* Clearly, the square-root model of market impact is consistent with this.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Realism of SFGK model\n",
    "\n",
    "* In real markets,  order depth falls off rapidly away from the best quote. \n",
    "\n",
    "\n",
    "* We would therefore not expect the behavior of the SFGK model deep in the order book to accurately mimic a real market.\n",
    "\n",
    "\n",
    "* However, close to the best quote, the SFGK model *does* appear to capture some salient aspects of real markets.\n",
    "\n",
    "\n",
    "* For example:\n",
    "\n",
    "    * A model in a similar style was shown by Bollerslev, Domowitz and Wang to accurately predict the distribution of bid-offer spreads in the foreign exchange market.\n",
    "    \n",
    "    * Farmer, Patelli and Zovko estimated $\\mu$, $\\alpha$ and $\\delta$ from London Stock Exchange SETS order book data, comparing average actual bid-offer spreads and volatilities against SFGK model predictions and finding agreement to be quite good.\n",
    "\n",
    "\n",
    "* As we shall see, there are inevitably some aspects of real markets that zero-intelligence models cannot mimic, notably those associated with strategic behavior of traders.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Implementation of the SFGK model\n",
    "\n",
    "* It is impossible to simulate order arrivals and cancelations at integer price levels from $-\\infty$ to $+\\infty$.\n",
    "\n",
    "\n",
    "* So consider only order arrivals and cancelations in a moving band of width $L$ centered around the current best quotes.\n",
    "\n",
    "    * $L$ should be chosen conservatively so as to ensure minimal edge effects.\n",
    "    * Within the band, the arrival rate of limit orders is $\\alpha$, cancelation rate is $\\delta$ times outstanding shares.\n",
    "    * Outside the band, orders may neither arrive nor be canceled.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Notation\n",
    "\n",
    "Table 2: Order book events\n",
    "\n",
    "|       Event       | Notation |\n",
    "|:-----------------:|:--------:|\n",
    "|  Limit buy order  |    LB    |\n",
    "|  Market buy order |    MB    |\n",
    "|  Cancel buy order |    CB    |\n",
    "| Market sell order |    MS    |\n",
    "|  Limit sell order |    LS    |\n",
    "| Cancel sell order |    CS    |\n",
    "\n",
    "We denote the probability of an event by $\\PP_{event}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## SFGK pseudo-code\n",
    "\n",
    "\n",
    "\n",
    "<font color=\"red\">\n",
    "- Compute the best bid $B(t)$ and best offer $A(t)$.\n",
    "\n",
    "- Compute the number $n_{B}$ of shares on the bid side of the book from level $A(t)-1$ to level\n",
    "$A(t)-L$.\n",
    "\n",
    "- Compute the number $n_{A}$ of shares on the offered side of the book\n",
    "from level $B(t)+1$ to level $B(t)+L$.\n",
    "\n",
    "- Draw a new event according to the relative probabilities\n",
    "$\n",
    "\\left\\{\\PP_{MB}, \\PP_{MS},\n",
    "\\PP_{LB}, \\PP_{LS}, \\PP_{CS}, \\PP_{CB}\\right\\} \\propto \\left\\{\\mu/2, \\mu/2,\n",
    "L\\,\\alpha, L\\,\\alpha, \\delta\\,{n_A}, \\delta\\,{n_B} \\right\\}\n",
    "$.\n",
    "\n",
    "    - If the selected event is a limit order, draw the relative\n",
    "price level from $\\left\\{1,2,\\ldots,L\\right\\}$.\n",
    "    - If the selected event is a cancelation, select randomly which order within the band to cancel.\n",
    "- Update the order book and increment $t$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Ouputs of simulation\n",
    "\n",
    "This simulation procedure yields a time series of order book data from which we extract\n",
    "quantities of interest such as spread, mid-quote etc.\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/ZI-price.png\" align = \"center\" width=700></h2>\n",
    "Figure 1: A typical sample path"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Introduction to R\n",
    "\n",
    "There are many places to learn about R.  I recommend:\n",
    "\n",
    "* *Introductory Statistics with R* by Peter Dalgaard\n",
    "\n",
    "\n",
    "* *R for Beginners* by Emmanuel Paradis available at http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf\n",
    "\n",
    "\n",
    "* *R for MATLAB users* available at http://mathesaurus.sourceforge.net/octave-r.html\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## R implementation of ZI simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "%load_ext rpy2.ipython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "%%R\n",
    "download.file(url=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/ziSetup.zip\", destfile=\"ziSetup.zip\")\n",
    "unzip(zipfile=\"ziSetup.zip\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "%%R \n",
    "source(\"ziSetup.R\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## What inside *ziSetp.R*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "%%R\n",
    "#Book setup\n",
    "L <- 30 #Set number of price levels to be included in iterations\n",
    "\n",
    "# Generate initial book\n",
    "LL <- 1000 #Total number of levels in buy and sell books\n",
    "\n",
    "# Initialize book with asymptotic depth of 5 shares\n",
    "initializeBook5 <- function()\n",
    "{\n",
    "  Price <<- -LL:LL    \n",
    "  # Book shape is set to equal long-term average from simulation\n",
    "  buySize <<- c(rep(5,LL-8),5,4,4,3,3,2,2,1,rep(0,LL+1))\n",
    "  sellSize <<- c(rep(0,LL),0,1,2,2,3,3,4,4,5,rep(5,LL-8))\n",
    "  book <<- data.frame(Price, buySize, sellSize ) \n",
    "  if(logging==T){eventLog <<- as.data.frame(matrix(0,nrow=numEvents,ncol=2))\n",
    "  colnames(eventLog)<<-c(\"Type\",\"Price\")\n",
    "  count <<- 0\n",
    "  eventType <<- c(\"LB\",\"LS\",\"CB\",\"CS\",\"MB\",\"MS\")\n",
    "  eventDescr <<- NA}\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "%%R\n",
    "#Various utility functions\n",
    "bestOffer <- function(){min(book$Price[book$sellSize>0])}\n",
    "bestBid <- function(){max(book$Price[book$buySize>0])}\n",
    "spread <- function(){bestOffer()-bestBid()}\n",
    "mid <- function(){(bestOffer()+bestBid())/2}\n",
    "\n",
    "#Functions to find mid-market\n",
    "bidPosn<-function()length(book$buySize[book$Price<=bestBid()])\n",
    "askPosn<-function()length(book$sellSize[book$Price<=bestOffer()])\n",
    "midPosn<-function(){floor((bidPosn()+askPosn())/2)}\n",
    "\n",
    "#Display center of book\n",
    "go <- function(){book[(midPosn()-20):(midPosn()+20),]}\n",
    "\n",
    "#Display book shape\n",
    "bookShape<-function(band){c(book$buySize[midPosn()+(-band:0)],book$sellSize[midPosn()+1:band])}\n",
    "bookPlot<-function(band){\n",
    "  plot((-band:band),bookShape(band),\n",
    "       col=\"red\",type=\"l\",xlab=\"Price\",ylab=\"Quantity\")\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "%%R\n",
    "#Choose from L whole numbers in (1,...,L) with uniform probability\n",
    "pick <- function(m){sample(1:m,1)}\n",
    "\n",
    "# Switch logging on\n",
    "logging <- T\n",
    "\n",
    "#Buy limit order\n",
    "limitBuyOrder <- function(price=NA){\n",
    "  if (is.na(price))\n",
    "  {prx <<- (bestOffer()-pick(L))}\n",
    "  else prx <<-price  \n",
    "  if(logging==T){eventLog[count,]<<- c(\"LB\",prx)} \n",
    "  book$buySize[book$Price==prx]<<-book$buySize[book$Price==prx]+1} \n",
    "\n",
    "#Sell limit order\n",
    "limitSellOrder <- function(price=NA){\n",
    "  if (is.na(price))\n",
    "  {prx <<- (bestBid()+pick(L))}\n",
    "  else prx <<-price  \n",
    "  if(logging==T){eventLog[count,] <<- c(\"LS\",prx)}  \n",
    "  book$sellSize[book$Price==prx]<<-book$sellSize[book$Price==prx]+1} \n",
    "\n",
    "#Cancel buy order            \n",
    "cancelBuyOrder<-function(price=NA){\n",
    "  q<-pick(nb) \n",
    "  tmp <- cumsum(rev(book$buySize))  #Cumulative buy size from 0\n",
    "  posn <- length(tmp[tmp>=q]) #gives position in list where cumulative size >q\n",
    "  prx <<- book$Price[posn] \n",
    "  if (!is.na(price)) {prx <<-price} \n",
    "  if(logging==T){eventLog[count,]<<- c(\"CB\",prx)} \n",
    "  book$buySize[posn]<<-book$buySize[posn]-1}\n",
    "\n",
    "\n",
    "#Cancel sell order\n",
    "cancelSellOrder<-function(price=NA){\n",
    "  q<-pick(ns) \n",
    "  tmp <- cumsum(book$sellSize)  #Cumulative sell size from 0\n",
    "  posn <- length(tmp[tmp<q])+1 \n",
    "  prx <<- book$Price[posn] \n",
    "  if (!is.na(price)) {prx <<-price}  \n",
    "  if(logging==T){eventLog[count,]<<- c(\"CS\",prx)} \n",
    "  book$sellSize[posn]<<-book$sellSize[posn]-1}\n",
    "\n",
    "#Market buy order\n",
    "marketBuyOrder <- function(){\n",
    "  prx <<- bestOffer() \n",
    "  if(logging==T){eventLog[count,]<<- c(\"MB\",prx)} \n",
    "  book$sellSize[book$Price==prx]<<-book$sellSize[book$Price==prx]-1}\n",
    "\n",
    "#Market sell order\n",
    "marketSellOrder <- function(){\n",
    "  prx <<- bestBid() \n",
    "  if(logging==T){eventLog[count,]<<- c(\"MS\",prx)} \n",
    "  book$buySize[book$Price==prx]<<-book$buySize[book$Price==prx]-1}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "%%R\n",
    "#Generate an event and update the buy and sell books\n",
    "#Note that limit orders may be placed inside the spread\n",
    "generateEvent <- function()\n",
    "    {\n",
    "    nb <<- sum(book$buySize[book$Price>=(bestOffer()-L)]); # Number of cancelable buy orders\n",
    "    ns <<- sum(book$sellSize[book$Price<=(bestBid()+L)]); # Number of cancelable sell orders\n",
    "    eventRate <- nb*delta + ns*delta + mu + 2*L*alpha;\n",
    "    probEvent <- c(L*alpha,L*alpha,nb*delta,ns*delta,mu/2,mu/2)/eventRate;\n",
    "    m <- sample(1:6, 1, replace = TRUE, probEvent); #Choose event type\n",
    "    switch(m,\n",
    "    \t\tlimitBuyOrder(),\n",
    "    \t\tlimitSellOrder(),\n",
    "    \t\tcancelBuyOrder(),\n",
    "    \t\tcancelSellOrder(),\n",
    "    \t\tmarketBuyOrder(),\n",
    "    \t\tmarketSellOrder()\n",
    "    \t\t);\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Average book shape in the  ZI simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAIAAADytinCAAAgAElEQVR4nO3deWATZeI+8Ce9oNyH\noohySGuhBSzKIQk3gjTlFioeWBVsF1ELX1EEXXVFV1cWbX/LrpZFVzwQiqsoNqUgcrZyiLDLTcKl\nclOkXKUt7fz+SLbpkZa0TeZ9Z+b5/JWZJJOnJTwM78y8Y1IUBUREJJ8A0QGIiMgzFjQRkaRY0ERE\nkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQR\nkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVN\nRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJB\nExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY\n0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCQpFjQRkaRY0EREkmJBExFJigVNRCSp\nINEBqicnJ+err75SFEV0ECIiAAgODn700UcDAwP9sXGN7UGvXr167dq1olMQEbl8+OGHR44c8dPG\nNbYHDcBisSQkJIhOQUQEAFu2bPHfxjW2B01EZB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K2yy3HWftKopiNpvtdnvpT6y4\n/XLvrWLLRF7iHjTJxfm9tNlsABYuXFj6qfDw8JJBg5KRhBKJiYlVDynExsampaUBSEtLi42N9Wab\nJTvOnTp1qvjvR4mS3Xzv0xJ5gwVNMoqJiUlOTi7pR6fSexbOIYsSJpNp1KhRiqfd8BLOtzhHqEve\nXsU2S9u1a1e5MKWVHij3Ji2Rl1jQJKmkpCSz2VwygJuQkJCSkgIgIyOj3Kkdzv3TmJiYcmsqiouL\ns1qtcXFx192m05w5c1Ch08sJCwszm83O15QcObzulom84uchFCJvVRzMda5xjhcrpY7LlRwPLHl9\ncnKy8ymz2Ww2m51jx86Rh4oDxyWjwxW3WRqAhISEyj6xXNqK26liy0ReMik8l5PIE5PJZLfbOTpB\nAnGIg4hIUtyDJiKSFPegiYgkxYImIpIUC5qISFIsaCIiSbGgiYgkxYImIpIUC5qISFIsaCIiSbGg\niYgkxYImIpIUC5qISFIsaCIiSbGgiYgkxYImIpIUC5qISFIsaCIiSf1/y87BKh8IoDAAAAAASUVO\nRK5CYII=\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%R\n",
    "# Figure 2: Average book shape (This take some time to run!)\n",
    "\n",
    "logging <- F # Very important for speed!\n",
    "\n",
    "alpha <- 1\n",
    "mu <- 10\n",
    "delta <- 1/5 \n",
    "initializeBook5()\n",
    "# Burn in for 1000 events\n",
    "for(count in 1:100){\n",
    "  generateEvent()\n",
    "}\n",
    "numEvents <- 100000 # Average over 100,000 events\n",
    "avgBookShape <- bookShape(20)/numEvents\n",
    "for(count in 2:numEvents){\n",
    "  generateEvent()\n",
    "  avgBookShape <- avgBookShape+bookShape(20)/numEvents\n",
    "}\n",
    "\n",
    "plot(-20:20,avgBookShape,main=NA,xlab=\"Relative price\",ylab=\"# Shares\", col=\"red\", type=\"b\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Figure 2: Average book shape over 100,000 events with $\\alpha$ = 1, $\\mu$ = 10, $\\delta$ = 1/5. Note that asymptotic book depth is $\\alpha/\\delta$ = 5."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Price signal in the  ZI simulation\n",
    "\n",
    "* Even in the ZI model, the shape of the order book allows prediction of price movements.\n",
    "\n",
    "    * Traders really would need to have zero intelligence not to condition on book shape!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/asymmetry.png\" align = \"center\" width=750></h2>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Figure 3: With one share at best offer, future price change vs size at best bid."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Further developments in ZI models\n",
    "\n",
    "* [Cont, Stoikov and Talreja]<sup id=\"cite_ref-ContStoikovTalreja\" class=\"reference\"><a href=\"#cite_note-ContStoikovTalreja\"><span>[</span>5<span>]</span></a></sup> analyze a generalized SFGK zero-intelligence (ZI) model as a Markov chain.\n",
    "\n",
    "* They show how to compute conditional probabilities using Laplace transform techniques.  For example:\n",
    "    \n",
    "    * The probability that the mid-price increases at its next move.\n",
    "        \n",
    "        * Depends on the order book imbalance.\n",
    "    \n",
    "    * The probability of executing an order before the mid-price moves.\n",
    "    \n",
    "    * The probability of making the spread.\n",
    "    \n",
    "        * Of interest to market makers.  Cancel limit orders if price is going to move!\n",
    "    \n",
    "    * [Cont, Stoikov and Talreja]<sup id=\"cite_ref-ContStoikovTalreja\" class=\"reference\"><a href=\"#cite_note-ContStoikovTalreja\"><span>[</span>5<span>]</span></a></sup> choose a limit order arrival (\"rain\") distribution and a cancelation distribution (by $\\Delta$) so as to match observed average book shapes for a Japanese stock.\n",
    "    \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Cont and de Larrard\n",
    "\n",
    "[Cont and de Larrard]<sup id=\"cite_ref-ContLarrard\" class=\"reference\"><a href=\"#cite_note-ContLarrard\"><span>[</span>3<span>]</span></a></sup> consider the following caricature of the ZI model, appropriate for large tick stocks:\n",
    "\n",
    "* Only quantities at the best bid and the best ask ($q_a$ and $q_b$ respectively) are considered.\n",
    "\n",
    "\n",
    "* All order sizes are for one unit.  Cancelations are not proportional to existing quantity.\n",
    "\n",
    "\n",
    "* $q_a$ and $q_b$ are independent.\n",
    "\n",
    "\n",
    "* The price moves down if $q_b \\downarrow 0$ and up if $q_a \\downarrow 0$.\n",
    "\n",
    "\n",
    "* After a price change, $q_a$ and $q_b$ are picked from a stationary distribution of queue sizes, independent of history (which could for example be empirically determined)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "In fact, \n",
    "\n",
    "\\begin{eqnarray*}\n",
    "&& q_a(t) = N^{LS}_t - N^{MB}_t - N^{CA}_t \\\\\n",
    "&& q_b(t) = N^{LB}_t - N^{MS}_t - N^{CB}_t \n",
    "\\end{eqnarray*}\n",
    "\n",
    "where \n",
    "\n",
    "* $N_t^{LS}$ and $N_t^{LB}$ are Poisson processes with intensity $\\lambda$ corresponding to limit orders\n",
    "\n",
    "* $N_t^{MS}$ and $N_t^{MB}$ are Poisson processes with intensity $\\mu$ corresponding to market orders\n",
    " \n",
    "* $N_t^{CA}$ and $N_t^{CB}$ are Poisson processes with intensity $\\delta$ corresponding to cancelation of limit orders\n",
    "\n",
    "All the processes are independent.\n",
    "\n",
    "Hence, $q_a(t)$ and $q_b(t)$ are compound Poisson processes with intensity $\\Lambda := \\lambda + \\mu + \\delta$ and jump size $J$ distributed as\n",
    "\n",
    "$$\n",
    "J = \\left\\{\\begin{array}{ll}\n",
    "1 & \\mbox{with probability } \\frac{\\lambda}{\\lambda + \\mu + \\delta}; \\\\\n",
    "\\\\\n",
    "-1 & \\mbox{with probability } \\frac{\\mu + \\delta}{\\lambda + \\mu + \\delta}.\n",
    "\\end{array}\\right.\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "[Cont and de Larrard]<sup id=\"cite_ref-ContLarrard\" class=\"reference\"><a href=\"#cite_note-ContLarrard\"><span>[</span>3<span>]</span></a></sup> derive closed-form asymptotic expressions for the following quantities:\n",
    "\n",
    "* Distribution of duration until the next price move.\n",
    "\n",
    "* Probability of upward move in the price.\n",
    "\n",
    "* Autocorrelation of price changes.\n",
    "\n",
    "* Price volatility.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Probability of price move up\n",
    "\n",
    "Cont and de Larrard derive the following asymptotic expression assuming a balanced book (a book where the arrival rate of limit orders balances the arrival rates of market orders and cancelations):\n",
    "\n",
    "<font color=\"red\">\n",
    "#### Proposition (Proposition 2 of Cont & de Larrard)\n",
    "The probability $\\phi(n,p)$ that the next price is an increase, conditioned on having $n$ orders at the bid and $p$ orders at the ask is:\n",
    "\n",
    "$$\n",
    "\\phi(n,p)=\\frac{1}{\\pi}\\,\\int_0^\\pi\\,\\left(2-\\cos t-\\sqrt{(2-\\cos t)^2-1}\\right)^p\\,\\frac{\\sin {n\\,t}\\,\\cos \\frac{t}{2}}{\\sin \\frac{t}{2}}\\, dt\n",
    "$$\n",
    "<font color=\"black\">\n",
    "\n",
    "* This leads to a natural expression for microprice in large tick markets!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Infinitesimal generator \n",
    "\n",
    "The infinitesimal generator of the (two dimensional) process $q_a(t)$ and $q_b(t)$ is \n",
    "\n",
    "$$\n",
    "\\mathcal{L} u(x,y) = \\lambda [u(x+h,y) + u(x,y+h) - 2u(x,y)] + (\\mu + \\delta)[u(x-h,y) + u(x,y-h) - 2u(x,y)] \n",
    "$$\n",
    "\n",
    "where $h$ is the tick size. \n",
    "\n",
    "Assume $\\lambda = \\mu + \\delta$, i.e., a balanced order book. Thus $\\lambda = \\mu + \\delta = \\frac\\Lambda2$. $\\mathcal{L}$ becomes\n",
    "\n",
    "$$\n",
    "\\mathcal{L} u(x,y) = \\frac\\Lambda2 [u(x+h,y) + u(x,y+h) + u(x-h,y) + u(x,y-h) - 4 u(x,y)]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Boundary value problem for probability of up move\n",
    "\n",
    "Denote $\\tau_a = \\inf\\{t \\geq 0: q_a(t) = 0\\}$ and  $\\tau_b = \\inf\\{t \\geq 0: q_b(t) = 0\\}$. In other words, $\\tau_a$ ($\\tau_b$ respectively) is the first time that the ask (bid respectively) side of the book is depleted.  \n",
    "\n",
    "Let $u(x,y) = \\PP\\left[\\tau_a \\leq \\tau_b|q_b = x, q_a = y \\right]$. That is, $u$ is the probability that, conditioned on $q_b = x$ and $q_a = y$, the ask side is depleted before the bid side. Consequently, $u$ is the probability that the price moves up. \n",
    "\n",
    "Then $u$ satisfies the parital difference equation \n",
    "\n",
    "$$\n",
    "\\mathcal{L} u(x,y) = 0 \\quad \\Longleftrightarrow \\quad u(x+h,y) + u(x,y+h) + u(x-h,y) + u(x,y-h) - 4 u(x,y) = 0, \\quad \\forall x, y > 0\n",
    "$$\n",
    "\n",
    "with boundary conditions \n",
    "\n",
    "$$\n",
    "u(x,0) = 1, \\; \\forall x \\geq 0 \\quad \\mbox{and} \\quad u(0,y) = 0, \\; \\forall y \\geq 0.\n",
    "$$\n",
    "\n",
    "The solution is given by $\\phi$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Probability that next move is up\n",
    "\n",
    "Let $\\phi(x,y)$ be the probability that the next move is up given a bid size of $x$ and an ask size of $y$.  Then the boundary conditions for [(1)](#eq:laplacian) are $\\phi(0,y)=0; \\, \\phi(x,0) = 1$.\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/Laplacian.png\" align = \"center\" width=500></h2>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## A heuristic asymptotic analysis\n",
    "\n",
    "Recall the difference equation for $u$\n",
    "\n",
    "$$\n",
    "u(x+h,y) + u(x,y+h) + u(x-h,y) + u(x,y-h) - 4 u(x,y) = 0.\n",
    "$$\n",
    "\n",
    "Rewrite the last equation as \n",
    "\n",
    "$$\n",
    "\\frac1{h^2} \\left[u(x+h,y) + u(x-h,y) - 2 u(x,y) \\right] + \\frac1{h^2} \\left[u(x,y+h) + u(x,y-h) - 2 u(x,y)\\right] = 0.\n",
    "$$\n",
    "\n",
    "In the limit, as $h \\to 0$, the difference equation converges to the Laplace equation\n",
    "\n",
    "<a name=\"eq:laplacian\"></a>(1)\n",
    "$$\n",
    "\\Delta u = u_{xx} + u_{yy} = 0 \n",
    "$$\n",
    "\n",
    "with boundary condition $u(x,0) = 1$ and $u(0,y) = 0$. \n",
    "\n",
    "Hence, for small $h$, we would expect the solution from PDE is approximately equal to the solution from difference equation.  \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Solving Laplace equation \n",
    "\n",
    "Rewriting [(1)](#eq:laplacian) in polar coordinates $(r,\\theta)$ gives\n",
    "\n",
    "$$\n",
    "\\Delta u(x,y) =  \\frac{\\p^2 u}{\\p r^2}+\\frac 1 r \\,\\frac{\\p u}{\\p r}+ \\frac 1 {r^2}\\frac{\\p^2 u}{\\p \\theta^2}.\n",
    "$$\n",
    "\n",
    "Radial symmetry gives $\\p_r u = 0$ so this equation simplifies to\n",
    "\n",
    "$$\n",
    "\\frac{\\p^2 u}{\\p \\theta^2} = 0.\n",
    "$$\n",
    "\n",
    "with solution\n",
    "\n",
    "$$\n",
    "u(r,\\theta)= a \\, \\theta+ b.\n",
    "$$\n",
    "\n",
    "Applying the boundary conditions, $u(r,\\pi/2)=0$ and $u(r,0) = 1$ gives\n",
    "\n",
    "$$\n",
    "u(x,y)= u(r,\\theta) = 1-\\frac 2 \\pi \\,\\theta = 1-\\frac 2 \\pi \\,\\arctan \\frac{y}{x}=\\frac 2 \\pi \\,\\arctan \\frac x y.\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Asymptotic vs Cont and de Larrard formula\n",
    "\n",
    "We set $y=1$ and plot $\\phi(x,1)$ vs $x$.\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/TaiHoVsCont.png\" align = \"center\" width=500></h2>\n",
    "Figure 4: The blue line is simply $\\frac 2 \\pi \\,\\arctan \\frac{x}{y}$; the red dashed line is the Cont and de Larrard formula $\\frac{1}{\\pi}\\,\\int_0^\\pi\\,dt\\,\\left(2-\\cos t-\\sqrt{(2-\\cos t)^2-1}\\right)^y\\,\\frac{\\sin {x\\,t}\\,\\cos \\frac{t}{2}}{\\sin \\frac{t}{2}}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Microprice\n",
    "\n",
    "Now that we have the probability of an up-tick, we may define a quantity which we may consider as an estimate of the efficient price.\n",
    "\n",
    "Denote the spread by $s$ and the mid-price by $M_t=(B_t+A_t)/2$.  Then we may define the  <span>* microprice*</span> $S_t$   as\n",
    "\n",
    "<a name=\"eq:microprice\"></a>(2)\n",
    "\\begin{eqnarray}\n",
    "S_t &=& \\mbox{mid-price} + \\mbox{half spread} \\times \\mbox{expected price move} \\\\\n",
    "&=& M_t + \\frac s 2 \\, \\left\\{2\\,\\phi(q_b,q_a)-1\\right\\}\\nonumber\\\\\n",
    "&\\approx&M_t + \\frac s 2 \\,\\left\\{\\frac 4\\pi \\,\\arctan \\frac {q_b} {q_a}-1\\right\\}.\n",
    "\\end{eqnarray}\n",
    "\n",
    "* If $q_b \\ll q_a$, $S_t \\approx M_t- s/2 = B_t$.\n",
    "\n",
    "* If $q_b \\gg q_a$, $S_t \\approx M_t+ s/2 = A_t$.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Order book imbalance\n",
    "\n",
    "[Lipton, Pesavento and Sotiropoulos]<sup id=\"cite_ref-LPS\" class=\"reference\"><a href=\"#cite_note-LPS\"><span>[</span>6<span>]</span></a></sup> define the *order book imbalance*\n",
    "\n",
    "$$\n",
    "I = \\frac{ q_b-q_a}{q_b+q_a}.\n",
    "$$\n",
    "\n",
    "In terms of $I$,  the microprice [(2)](#eq:microprice) becomes\n",
    "\n",
    "\\begin{eqnarray}\n",
    "S_t &\\approx&M_t + \\frac s 2 \\,\\left\\{\\frac 4\\pi \\,\\arctan \\frac {q_b} {q_a}-1\\right\\}\\\\\n",
    "&=&M_t + \\frac s 2 \\,\\frac 4\\pi \\,\\arctan \\frac{ q_b-q_a}{q_b+q_a}\\\\\n",
    "&=&M_t + \\frac s 2 \\,\\frac 4\\pi \\,\\arctan I.\n",
    "\\end{eqnarray}\n",
    "\n",
    "* We see that book imbalance seems to be the right variable in the sense that $S_t$ is linear in $I$ for small $I$.\n",
    "\n",
    "    * Moreover, $I$ is anti-symmetric in $q_b$ and $q_a$.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Order book imbalance empirically\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/LPSfig1.png\" align = \"center\" width=550></h2>\n",
    "\n",
    "Figure 5: Empirical average price move and expected time to next tick from [Lipton, Pesavento and Sotiropoulos]<sup id=\"cite_ref-LPS\" class=\"reference\"><a href=\"#cite_note-LPS\"><span>[</span>6<span>]</span></a></sup>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Graph of microprice vs order book imbalance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAYAAAB91L6VAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAOI2N\nVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4\nA4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJ\nGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19\nHvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzz\nHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+Bkm\nfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q\n00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8O\ncxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqh\nz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s\n15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+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S1mHYD1m8utW7d2rnhbtGjhvJGsn9Neeumlzq1q/cZ02lvb+hmvfk48cuRI58r33nvvFR38\nslt0WgMGDHBuVeurW/2WtA62+ja5Xq9ve+u3qvV3/XJWVlfy+nm1vlqvX79+llnpbfrZNgsC8Spg\n2P3w6IgXr61PvX0loK9aDx486HT/SVtwvU7fRta3n0Mt+p+5vhI+55xzQu2S5Xr9HFqnr7sMpV10\nNyj9PwM68Ida9NvV8+fPd26RZ9xHH6ufZeur7IxpZ9yX7wgEVYAAHNSWpV4IuCygg77uaqSvnCtU\nqJCuNLrrkg7eTzzxRLr1fEEgngR4BhxPrU1dEYihgL4q1/2aN27cmClXHXxbtWqVaT0rEIgnAa6A\n46m1qSsCCCCAgGcEuAL2TFNQEAQQQACBeBIgAMdTa1NXBBBAAAHPCBCAPdMUFAQBBBBAIJ4ECMDx\n1NrUFQEEEEDAMwIEYM80BQVBAAEEEIgnAQJwPLU2dUUAAQQQ8IwAAdgzTUFBEEAAAQTiSYAAHE+t\nTV0RQAABBDwjQAD2TFNQEAQQQACBeBIgAMdTa1NXBBBAAAHPCBCAPdMUFAQBBBBAIJ4ECMDx1NrU\nFQEEEEDAMwIEYM80BQVBAAEEEIgnAQJwPLU2dUUAAQQQ8IzA/wOjOMkmwQ/81QAAAABJRU5ErkJg\ngg==\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%R\n",
    "# Figure 6: Microprice vs order book imbalance \n",
    "mPrice <- function(imbalance){4/pi*atan(imbalance)}\n",
    "curve(mPrice(x),from=-1,to=1,col=\"red\",xlab=\"Imbalance (I)\",ylab=\"Microprice/Half-spread\")\n",
    "abline(h=0,lty=2)\n",
    "abline(v=0,lty=2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "Figure 6: Microprice as a function of the order book imbalance I\n",
    "\n",
    "* It looks nearly linear!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Price signal in the  ZI simulation vs book imbalance\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/asymmetryImbalance.png\" align = \"center\" width=650></h2>\n",
    "Figure 7: With one share at best offer, future price change vs book imbalance"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Price signal in the  ZI simulation vs microprice\n",
    "\n",
    "<h2><img src=\"http://mfe.baruch.cuny.edu/wp-content/uploads/2015/01/asymmetryMicroprice.png\" align = \"center\" width=650></h2>\n",
    "Figure 8: With one share at best offer, future price change vs microprice"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### References\n",
    "\n",
    "<br />\n",
    "\n",
    "<div class=\"reflist\" style=\"list-style-type: decimal;\">\n",
    "\n",
    "<ol>\n",
    "\n",
    "  <li id=\"cite_note-AbergelJedidi\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-AbergelJedidi\">^</a></b></span> Frédéric Abergel and Aymen Jedidi, A Mathematical Approach to Order Book Modeling, <span>* International Journal of Theoretical and Applied Finance*</span>, <span>**16**(5)</span> 1350025-1350040 (2013).</li>\n",
    "\n",
    "  <li id=\"cite_note-BouchaudFarmerLillo\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-BouchaudFarmerLillo\">^</a></b></span>   Jean-Philippe Bouchaud, J. Doyne Farmer, and Fabrizio Lillo, How Markets Slowly Digest Changes in Supply and Demand, in <span>* Handbook of Financial Markets: Dynamics and Evolution*</span> 57-156. (2009) available at http://tuvalu.santafe.edu/%7Ejdf/papers/MarketsSlowlyDigest.pdf: Sections 2.2 and 2.9.3.</li>\n",
    "\n",
    "  <li id=\"cite_note-ContLarrard\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-ContLarrard\">^</a></b></span>   Rama Cont and Adrien de Larrard, Price dynamics in a Markovian limit order market, <span>* SIAM J. Finan. Math.*</span>,  <span>** 4**</span>(1) 1-25 (2013).</li>\n",
    "  \n",
    "  <li id=\"cite_note-ContLarrard2\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-ContLarrard2\">^</a></b></span>   Rama Cont and Adrien de Larrard, Order book dynamics in liquid markets: limit theorems and diffusion approximations, <span>* SSRN*</span>, (2011).</li>\n",
    "  \n",
    "    <li id=\"cite_note-ContStoikovTalreja\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-ContStoikovTalreja\">^</a></b></span>   Rama Cont, Sasha Stoikov and Rishi Talreja, A stochastic model for order book dynamics,\n",
    "<span>* Operations Research*</span>,  <span>**58**</span> 549-563 (2010).</li>\n",
    "\n",
    "    <li id=\"cite_note-LPS\"><span class=\"mw-cite-backlink\"><b><a href=\"#cite_ref-LPS\">^</a></b></span>   Alexander Lipton, Umberto Pesavento, and Michael G Sotiropoulos, Trade arrival dynamics and quote imbalance in a limit order book, <span>* arXiv*</span> (2013).</li>\n",
    "  \n",
    "</ol>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
